package com.genesis.yunnanji.view;

import android.support.v4.app.Fragment;
import android.view.View;

import com.flyco.tablayout.SlidingTabLayout;

import com.genesis.yunnanji.R;
import com.genesis.yunnanji.adapter.ClassifySortAdapter;
import com.genesis.yunnanji.view.fragment.AllOrderFragment;
import com.genesis.yunnanji.view.fragment.EvaluateOrderFragment;
import com.genesis.yunnanji.view.fragment.ForGoodsOrderFragment;
import com.genesis.yunnanji.view.fragment.PayOrderFragment;
import com.genesis.yunnanji.view.fragment.SendOrderFragment;
import com.genesis.yunnanji.widget.NoScrollViewPager;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * 我的订单
 */

public class UserOrderActivity extends BaseActivity {

    @BindView(R.id.vp_content)
    NoScrollViewPager vpContent;


    @BindView(R.id.tabs)
    SlidingTabLayout tabs;

    private ArrayList<String> functionList = new ArrayList<>();

    private List<Fragment> fragmentList = new ArrayList<>();

    @Override
    public int getLayoutId() {
        return R.layout.activity_user_order;
    }

    @Override
    public void initView() {
        super.initView();
        setTitle("我的订单");
        addMenuImageItem(R.drawable.home_search, new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });
        functionList.add("全部");
        functionList.add("待付款");
        functionList.add("待发货");
        functionList.add("待收货");
        functionList.add("待评价");

        fragmentList.add(AllOrderFragment.newInstance());
        fragmentList.add(PayOrderFragment.newInstance());
        fragmentList.add(SendOrderFragment.newInstance());
        fragmentList.add(ForGoodsOrderFragment.newInstance());
        fragmentList.add(EvaluateOrderFragment.newInstance());

        ClassifySortAdapter classifySortAdapter = new ClassifySortAdapter(getSupportFragmentManager(), fragmentList, functionList);
        vpContent.setAdapter(classifySortAdapter);
        tabs.setViewPager(vpContent);
        vpContent.setCurrentItem(0);
        vpContent.setOffscreenPageLimit(5);
    }
}
